package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202410;

public class leetcode20241015 {
    public int maxHeightOfTriangle(int red,int blue){
        return Math.max(maxHeightOfTriangle(red,blue),maxHeightOfTriangle(blue,red));
    }

    public int maxHeight(int x,int y){
        int odd=2*(int)(Math.sqrt(x))-1;// 等差数列求和
        int even=2*(int)((-1+Math.sqrt(1+4*y))/2);
        return Math.min(odd,even)+1;
    }
}
